package com.agy.filemanager.controller;

import com.agy.filemanager.entity.ProjectInfo;
import com.agy.filemanager.service.ProjectInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 项目信息Controller
 */
@RestController
public class ProjectInfoController {

    @Autowired
    private ProjectInfoService projectInfoService;

    /**
     * 保存项目基本信息
     * @param projectInfo
     * @return
     */
    @PostMapping("entity")
    public ResponseEntity insertProjectInfoBase(ProjectInfo projectInfo){
        projectInfoService.insertProjectInfoBase(projectInfo);
        return ResponseEntity.ok("保存成功");
    }

    /**
     * 根据id查询项目基本信息
     * @param id
     * @return
     */
    @GetMapping("entity/{id}")
    public ResponseEntity<ProjectInfo> queryProjectInfoById(@PathVariable String id){
        ProjectInfo projectInfo = projectInfoService.queryProjectInfoById(id);
        return ResponseEntity.ok(projectInfo);
    };


}
